﻿#region Usings

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using Rail.Net.Properties;

#endregion

#pragma warning disable 1591

namespace Rail.Net.KontengentFreigeben
{
    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [WebServiceBinding(Name = "KONTINGENTFREIGEBENBinding", Namespace = "urn:KONTINGENTFREIGEBEN-interface")]
    public class KONTINGENTFREIGEBENService : SoapHttpClientProtocol
    {
        private SendOrPostCallback KONTINGENTFREIGEBENOperationCompleted;

        private bool useDefaultCredentialsSetExplicitly;

        /// <remarks />
        public KONTINGENTFREIGEBENService()
        {
            Url = Settings.Default.Rail_Net_KontengentFreigeben_KONTINGENTFREIGEBENService;
            if (IsLocalFileSystemWebService(Url))
            {
                UseDefaultCredentials = true;
                useDefaultCredentialsSetExplicitly = false;
            }
            else
            {
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        public Session SessionValue { get; set; }

        public Encoding EncodingValue { get; set; }

        public new string Url
        {
            get { return base.Url; }
            set
            {
                if (((IsLocalFileSystemWebService(base.Url)
                      && (useDefaultCredentialsSetExplicitly == false))
                     && (IsLocalFileSystemWebService(value) == false)))
                {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }

        public new bool UseDefaultCredentials
        {
            get { return base.UseDefaultCredentials; }
            set
            {
                base.UseDefaultCredentials = value;
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        /// <remarks />
        public event KONTINGENTFREIGEBENCompletedEventHandler KONTINGENTFREIGEBENCompleted;

        /// <remarks />
        [SoapHeader("SessionValue", Direction = SoapHeaderDirection.InOut)]
        [SoapHeader("EncodingValue")]
        [SoapDocumentMethod("KONTINGENTFREIGEBEN", Use = SoapBindingUse.Literal,
            ParameterStyle = SoapParameterStyle.Bare)]
        [return: XmlElement("KONTINGENTFREIGEBENResponse0", Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
        public KONTINGENTFREIGEBENResponse0 KONTINGENTFREIGEBEN(
            [XmlElement("KONTINGENTFREIGEBEN", Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")] KONTINGENTFREIGEBEN
                KONTINGENTFREIGEBEN1)
        {
            var results = Invoke("KONTINGENTFREIGEBEN", new object[]
                                                            {
                                                                KONTINGENTFREIGEBEN1
                                                            });
            return ((KONTINGENTFREIGEBENResponse0) (results[0]));
        }

        /// <remarks />
        public void KONTINGENTFREIGEBENAsync(KONTINGENTFREIGEBEN KONTINGENTFREIGEBEN1)
        {
            KONTINGENTFREIGEBENAsync(KONTINGENTFREIGEBEN1, null);
        }

        /// <remarks />
        public void KONTINGENTFREIGEBENAsync(KONTINGENTFREIGEBEN KONTINGENTFREIGEBEN1, object userState)
        {
            if ((KONTINGENTFREIGEBENOperationCompleted == null))
            {
                KONTINGENTFREIGEBENOperationCompleted = new SendOrPostCallback(OnKONTINGENTFREIGEBENOperationCompleted);
            }
            InvokeAsync("KONTINGENTFREIGEBEN", new object[]
                                                   {
                                                       KONTINGENTFREIGEBEN1
                                                   }, KONTINGENTFREIGEBENOperationCompleted, userState);
        }

        private void OnKONTINGENTFREIGEBENOperationCompleted(object arg)
        {
            if ((KONTINGENTFREIGEBENCompleted != null))
            {
                var invokeArgs = ((InvokeCompletedEventArgs) (arg));
                KONTINGENTFREIGEBENCompleted(this,
                                             new KONTINGENTFREIGEBENCompletedEventArgs(invokeArgs.Results,
                                                                                       invokeArgs.Error,
                                                                                       invokeArgs.Cancelled,
                                                                                       invokeArgs.UserState));
            }
        }

        /// <remarks />
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }

        private bool IsLocalFileSystemWebService(string url)
        {
            if (((url == null)
                 || (url == string.Empty)))
            {
                return false;
            }
            var wsUri = new Uri(url);
            if (((wsUri.Port >= 1024)
                 && (string.Compare(wsUri.Host, "localHost", StringComparison.OrdinalIgnoreCase) == 0)))
            {
                return true;
            }
            return false;
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(AnonymousType = true, Namespace = "urn:compaq_nsk_oss_SoapHeader")]
    [XmlRoot(Namespace = "urn:compaq_nsk_oss_SoapHeader", IsNullable = false)]
    public class Session : SoapHeader
    {
        private string beginNewTransactionField;

        private string currentTransactionCommandField;

        private string sessionCommandField;
        private string sessionIDField;

        private string subsessionField;

        /// <remarks />
        [XmlAttribute]
        public string SessionID
        {
            get { return sessionIDField; }
            set { sessionIDField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string BeginNewTransaction
        {
            get { return beginNewTransactionField; }
            set { beginNewTransactionField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string CurrentTransactionCommand
        {
            get { return currentTransactionCommandField; }
            set { currentTransactionCommandField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string SessionCommand
        {
            get { return sessionCommandField; }
            set { sessionCommandField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string Subsession
        {
            get { return subsessionField; }
            set { subsessionField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class request
    {
        private string fillerField;
        private string preis_retField;

        /// <remarks />
        public string preis_ret
        {
            get { return preis_retField; }
            set { preis_retField = value; }
        }

        /// <remarks />
        public string filler
        {
            get { return fillerField; }
            set { fillerField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class header
    {
        private short lenheaderField;

        private short lenreplyField;
        private uint servicekeyField;

        private int value_serviceField;

        /// <remarks />
        public uint servicekey
        {
            get { return servicekeyField; }
            set { servicekeyField = value; }
        }

        /// <remarks />
        public int value_service
        {
            get { return value_serviceField; }
            set { value_serviceField = value; }
        }

        /// <remarks />
        public short lenheader
        {
            get { return lenheaderField; }
            set { lenheaderField = value; }
        }

        /// <remarks />
        public short lenreply
        {
            get { return lenreplyField; }
            set { lenreplyField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class KONTINGENTFREIGEBENResponse0
    {
        private header headerField;

        private request requestField;

        /// <remarks />
        public header header
        {
            get { return headerField; }
            set { headerField = value; }
        }

        /// <remarks />
        public request request
        {
            get { return requestField; }
            set { requestField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class as_pers_anz
    {
        private string anzahlField;

        private string fillerField;
        private string pers_artField;

        /// <remarks />
        public string pers_art
        {
            get { return pers_artField; }
            set { pers_artField = value; }
        }

        /// <remarks />
        public string anzahl
        {
            get { return anzahlField; }
            set { anzahlField = value; }
        }

        /// <remarks />
        public string filler
        {
            get { return fillerField; }
            set { fillerField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class request_7_0
    {
        private string appField;
        private as_pers_anz[] as_pers_anzField;
        private string dl_kontiField;

        private string kassaField;
        private string ref_nr_ktgField;

        private string servField;
        private string termbfField;

        private string v_kanalField;
        private string v_sysField;

        /// <remarks />
        public string dl_konti
        {
            get { return dl_kontiField; }
            set { dl_kontiField = value; }
        }

        /// <remarks />
        public string ref_nr_ktg
        {
            get { return ref_nr_ktgField; }
            set { ref_nr_ktgField = value; }
        }

        /// <remarks />
        [XmlElement("as_pers_anz")]
        public as_pers_anz[] as_pers_anz
        {
            get { return as_pers_anzField; }
            set { as_pers_anzField = value; }
        }

        /// <remarks />
        public string termbf
        {
            get { return termbfField; }
            set { termbfField = value; }
        }

        /// <remarks />
        public string app
        {
            get { return appField; }
            set { appField = value; }
        }

        /// <remarks />
        public string kassa
        {
            get { return kassaField; }
            set { kassaField = value; }
        }

        /// <remarks />
        public string serv
        {
            get { return servField; }
            set { servField = value; }
        }

        /// <remarks />
        public string v_sys
        {
            get { return v_sysField; }
            set { v_sysField = value; }
        }

        /// <remarks />
        public string v_kanal
        {
            get { return v_kanalField; }
            set { v_kanalField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class header_1_0
    {
        private short endheadField;
        private short lenbufField;
        private short lenheaderField;

        private short maxreplyField;
        private uint servicekeyField;

        /// <remarks />
        public uint servicekey
        {
            get { return servicekeyField; }
            set { servicekeyField = value; }
        }

        /// <remarks />
        public short lenheader
        {
            get { return lenheaderField; }
            set { lenheaderField = value; }
        }

        /// <remarks />
        public short lenbuf
        {
            get { return lenbufField; }
            set { lenbufField = value; }
        }

        /// <remarks />
        public short maxreply
        {
            get { return maxreplyField; }
            set { maxreplyField = value; }
        }

        /// <remarks />
        public short endhead
        {
            get { return endheadField; }
            set { endheadField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTFREIGEBEN")]
    public class KONTINGENTFREIGEBEN
    {
        private header_1_0 headerField;

        private request_7_0 requestField;

        /// <remarks />
        public header_1_0 header
        {
            get { return headerField; }
            set { headerField = value; }
        }

        /// <remarks />
        public request_7_0 request
        {
            get { return requestField; }
            set { requestField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(AnonymousType = true, Namespace = "urn:compaq_nsk_oss_SoapHeader")]
    [XmlRoot(Namespace = "urn:compaq_nsk_oss_SoapHeader", IsNullable = false)]
    public class Encoding : SoapHeader
    {
        private string outputEncodingField;

        /// <remarks />
        [XmlAttribute]
        public string OutputEncoding
        {
            get { return outputEncodingField; }
            set { outputEncodingField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    public delegate void KONTINGENTFREIGEBENCompletedEventHandler(object sender, KONTINGENTFREIGEBENCompletedEventArgs e
        );

    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    public class KONTINGENTFREIGEBENCompletedEventArgs : AsyncCompletedEventArgs
    {
        private readonly object[] results;

        internal KONTINGENTFREIGEBENCompletedEventArgs(object[] results, Exception exception, bool cancelled,
                                                       object userState) :
                                                           base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks />
        public KONTINGENTFREIGEBENResponse0 Result
        {
            get
            {
                RaiseExceptionIfNecessary();
                return ((KONTINGENTFREIGEBENResponse0) (results[0]));
            }
        }
    }
}

#pragma warning restore 1591